﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Drawing;
using MyDataGridView.Properties;

namespace MyDataGridView
{
    public partial class MyDataGridViewTextBoxColumn : System.Windows.Forms.DataGridViewTextBoxColumn
    {
        public MyDataGridViewTextBoxColumn()
        {
            InitializeComponent();
        }

        public MyDataGridViewTextBoxColumn(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        private Image backgroundImage = Properties.Resources.images;
        [Category("自定义"), Description("表头背景图")]
        [Browsable(true)]
        public Image BackgroundImage
        {
            get
            {
                return backgroundImage;
            }
            set
            {
                backgroundImage = value;
            }
        }

        public override System.Windows.Forms.DataGridViewCell CellTemplate
        {
            get
            {
                return base.CellTemplate;
            }
            set
            {
                base.CellTemplate = value;
                Graphics g = Graphics.FromImage(backgroundImage);
                g.DrawImage(backgroundImage,0,0);
            }
        }
    }
}
